#!/bin/bash

wlist="wlist.txt"

for k in 20
do
    files=$(ls ${1})
    for file in $files 
    do
        input="${1}/${file}"
	echo ""	
	time1=$(date)
	echo ${time1}
	
	filename="${file%%.*}"
    	bef=`grep "^$filename" $wlist`	

	echo "timeout 12000 ../../../KDefective -r ${input} -O solve -a RDS -p -D Set -k ${k} -t 10800"
	
	if [ -n "$bef" ]
	then 
	    echo "Wrong before !!!"
	else 
	    timeout 12000 ../../../KDefective -r ${input} -O solve -a RDS -p -D Set -k ${k} -t 10800
	fi
    done
done
